// pages/bzjpage/bzjpage.js
const SERVER = require('../../utils/index');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    array: ['10000', '20000', '30000', '40000'],
    index: 0,
    lotIds: "",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options)
    this.setData({
      lotIds: options.lotId
    })
    var that=this
    
    wx.request({//首页数据
      url: '' + SERVER.SERVER_DIMAIN + '/proxy/sign/getSignNumList', 
      data: {
        auctionId:options.id
      },
      header: {
        'content-type': 'application/json' ,
        "TENANT-ID":"2",
        "Connection":'Keep-alive',
        "Accept-Encoding":'gzip,deflate,br',
        "Authorization":"Bearer "+wx.getStorageSync('token'),
        "DEVICE_TYPE":'IOS'
      },
      method: 'get',
      success: function (res) {
        console.log(res.data.code)
        if(res.data.code=='1'){
          wx.showToast({

            title: '您还未通过实名认证',
       
            icon: 'none',
       
            duration: 2000//持续的时间
       
          })
        }
        
        // that.setData({
        //   list:res.data.data
        // })
        
     
       
      }
    });
    wx.request({//获取号牌
      url: '' + SERVER.SERVER_DIMAIN + '/proxy/sign/getSignNumList', 
      data: {
        auctionId: options.id
      },
      header: {
        'content-type': 'application/json' ,
        "TENANT-ID":"2",
        "Connection":'Keep-alive',
        "Accept-Encoding":'gzip,deflate,br',
        "Authorization":"Bearer "+wx.getStorageSync('token'),
        "DEVICE_TYPE":'IOS'
      },
      method: 'get',
      success: function (res) {
        console.log(res)
        that.setData({
          list:res.data.data.records
        })
      }
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },
  bindPickerChange: function(e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      index: e.detail.value
    })
  },
  uploadprice(){ // 修改委托价格
    console.log(this.data.array)
      console.log(this.data.array[this.data.index])

    wx.request({ // 修改委托价格接口
      url: '' + SERVER.SERVER_DIMAIN + '/proxy/lotproxy/addProxy', 
      data: {
        id: '', // 主键id
        lotId: this.data.lotIds, // lotId
        maxPrice: this.data.array[this.data.index], // 代理金额
        signNum: '', // 牌子号
      },
      header: {
        'content-type': 'application/json' ,
        "TENANT-ID":"2",
        "Connection":'Keep-alive',
        "Accept-Encoding":'gzip,deflate,br',
        "Authorization":"Bearer "+wx.getStorageSync('token'),
        "DEVICE_TYPE":'IOS'
      },
      method: 'get',
      success: function (res) {
        console.log(res)
        that.setData({
          list:res.data.data.records
        })
      }
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})